<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
</head>
<body>
<div id="box">
    <input type="button" @click="a='aaa'" value="aaa组件">
    <input type="button" @click="a='bbb'" value="bbb组件">
    <component :is="a"></component>
</div>
</body>
<script type="text/javascript" src="./bower_components/vue/dist/vue.min.js"></script>
<script>
    var vm=new Vue({
        el:'#box',
        data:{
            a:'aaa'
        },
        components:{
            'aaa':{
                template:'<h2>我是aaa组件</h2>'
            },
            'bbb':{
                template:'<h2>我是bbb组件</h2>'
            }
        }
   });

</script>
</html>